#include "relogioismalia.h"
#include <GL/gl.h>
#include <GL/glu.h>
#include <gllib/Objects.h>

void RelogioIsmalia::draw()
{
    //Parte externa do relógio

    glPushMatrix();
    glColor3f(0.5,0.5,1.0);
    glTranslatef(0.0, 1.0, 0.0);
    glRotatef(90.0,1.0,0.0,0.0);
    glScalef(1.0, 1.0, 1.0);
    gllibCylinder(0.25,0.05,10);
    glPopMatrix();

    //Parte interna do relógio

    glPushMatrix();
    glColor3f(1.0,1.0,1.0);
    glTranslatef(0.0, 1.0, 0.025);
    glRotatef(90.0,1.0,0.0,0.0);
    glScalef(1.0, 1.0, 1.0);
    gllibCylinder(0.2,0.01,10);
    glPopMatrix();

    //Pequenos traços indicadores de horas

    //12
    glPushMatrix();
    glColor3f(0.0,0.0,0.0);
    glTranslatef(0.001, 1.16, 0.03);
    glRotatef(90.0,1.0,0.0,0.0);
    glScalef(0.1, 0.1, 0.8);
    gllibCube(0.05);
    glPopMatrix();

    //6
    glPushMatrix();
    glColor3f(0.0,0.0,0.0);
    glTranslatef(0.001, 0.85, 0.03);
    glRotatef(90.0,1.0,0.0,0.0);
    glScalef(0.1, 0.1, 0.8);
    gllibCube(0.05);
    glPopMatrix();

    //3
    glPushMatrix();
    glColor3f(0.0,0.0,0.0);
    glTranslatef(0.16, 1.0, 0.03);
    glRotatef(90.0,0.0,1.0,0.0);
    glScalef(0.1, 0.1, 0.8);
    gllibCube(0.05);
    glPopMatrix();

    //9
    glPushMatrix();
    glColor3f(0.0,0.0,0.0);
    glTranslatef(-0.16, 1.0, 0.03);
    glRotatef(90.0,0.0,1.0,0.0);
    glScalef(0.1, 0.1, 0.8);
    gllibCube(0.05);
    glPopMatrix();

    //1
    glPushMatrix();
    glColor3f(0.0,0.0,0.0);
    glTranslatef(0.09, 1.13, 0.03);
    glRotatef(90.0,0.0,1.0,0.0);
    glRotatef(-50.0,1.0,0.0,0.0);
    glScalef(0.1, 0.1, 0.8);
    gllibCube(0.05);
    glPopMatrix();

    //2
    glPushMatrix();
    glColor3f(0.0,0.0,0.0);
    glTranslatef(0.14, 1.08, 0.03);
    glRotatef(90.0,0.0,1.0,0.0);
    glRotatef(-30.0,1.0,0.0,0.0);
    glScalef(0.1, 0.1, 0.8);
    gllibCube(0.05);
    glPopMatrix();

    //5
    glPushMatrix();
    glColor3f(0.0,0.0,0.0);
    glTranslatef(0.09, 0.88, 0.03);
    glRotatef(90.0,0.0,1.0,0.0);
    glRotatef(50.0,1.0,0.0,0.0);
    glScalef(0.1, 0.1, 0.8);
    gllibCube(0.05);
    glPopMatrix();

    //4
    glPushMatrix();
    glColor3f(0.0,0.0,0.0);
    glTranslatef(0.14, 0.93, 0.03);
    glRotatef(90.0,0.0,1.0,0.0);
    glRotatef(30.0,1.0,0.0,0.0);
    glScalef(0.1, 0.1, 0.8);
    gllibCube(0.05);
    glPopMatrix();

    //8
    glPushMatrix();
    glColor3f(0.0,0.0,0.0);
    glTranslatef(-0.14, 0.93, 0.03);
    glRotatef(90.0,0.0,1.0,0.0);
    glRotatef(-30.0,1.0,0.0,0.0);
    glScalef(0.1, 0.1, 0.8);
    gllibCube(0.05);
    glPopMatrix();

    //7
    glPushMatrix();
    glColor3f(0.0,0.0,0.0);
    glTranslatef(-0.09, 0.88, 0.03);
    glRotatef(90.0,0.0,1.0,0.0);
    glRotatef(-50.0,1.0,0.0,0.0);
    glScalef(0.1, 0.1, 0.8);
    gllibCube(0.05);
    glPopMatrix();

    //11
    glPushMatrix();
    glColor3f(0.0,0.0,0.0);
    glTranslatef(-0.09, 1.13, 0.03);
    glRotatef(90.0,0.0,1.0,0.0);
    glRotatef(50.0,1.0,0.0,0.0);
    glScalef(0.1, 0.1, 0.8);
    gllibCube(0.05);
    glPopMatrix();

    //10
    glPushMatrix();
    glColor3f(0.0,0.0,0.0);
    glTranslatef(-0.14, 1.08, 0.03);
    glRotatef(90.0,0.0,1.0,0.0);
    glRotatef(30.0,1.0,0.0,0.0);
    glScalef(0.1, 0.1, 0.8);
    gllibCube(0.05);
    glPopMatrix();

    //Ponteiro de segundos

    glPushMatrix();
    glColor3f(0.0,0.0,0.0);
    glTranslatef(0.0095, 1.05, 0.03);
    glRotatef(90.0,0.0,1.0,0.0);
    glScalef(0.09, 2.0, 0.09);
    gllibCube(0.05);
    glPopMatrix();

    //Ponteiro de minutos

    glPushMatrix();
    glColor3f(0.0,0.0,0.0);
    glTranslatef(0.048, 1.0, 0.03);
    glRotatef(90.0,0.0,0.0,1.0);
    glScalef(0.15, 1.8, 0.15);
    gllibCube(0.05);
    glPopMatrix();

    //Ponteiro de horas

    glPushMatrix();
    glColor3f(0.0,0.0,0.0);
    glTranslatef(-0.002, 0.965, 0.03);
    glRotatef(-20.0,0.0,0.0,1.0);
    glScalef(0.25, 1.8, 0.25);
    gllibCube(0.05);
    glPopMatrix();

    //Enfeite no centro dos ponteiros

    glPushMatrix();
    glColor3f(0.5,0.5,1.0);
    glTranslatef(0.012, 1.0, 0.03);
    glScalef(1.0, 1.0, 1.0);
    gllibSphere(0.012,10);
    glPopMatrix();
}
